<?php

$con = mysqli_connect("localhost","root","root","test");

if( !$con ){
    die("数据库连接错误，错误信息：" . mysqli_error($con));
}


# 获取用户信息; 
$username = $_GET["username"];
$password = $_GET["password"];



if(!$username  || !$password) {
    die("抱歉参不足");
}


echo "数据库连接成功";
# 加密password 
// $password = md5($password);


# - 拼接sql语句 
$insert_sql = "INSERT INTO `users` VALUES (Null,'$username' , '$password' )";

# - 执行sql语句; 
$res = mysqli_query($con , $insert_sql);


# 判断 $res 是不是错误结果; 
if(!$res){
    die("数据库插入错误，错误原因：" . mysqli_error($con));

}











// mysqli_close($con);
